/*
 * ColumnColourRenderer.java
 *
 * Created on 11 de marzo de 2008, 04:49 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package prototipo;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author Billy
 */
public class ColumnColourRenderer extends DefaultTableCellRenderer{
    
    /** Creates a new instance of ColumnColourRenderer */
//    public ColumnColourRenderer() {
//    }
        public ColumnColourRenderer() {
                super();
        }

        public Component getTableCellRendererComponent(JTable table, Object value,
                        boolean isSelected, boolean cellHasFocus, int row, int column) {

                        setText((table.getModel().getValueAt(row, column)).toString());

                        if (isSelected) {
                                 setBackground(table.getSelectionBackground());
                                 setForeground(table.getSelectionForeground());
                        }
                        else {
                                setBackground(Color.lightGray);
                        }

                return this;
        }    
}
